The <validators> element contains information on the validators that can be used by transformers and targets to check a given model before it is processed.

There can be more than one model validator, and transformers and targets may declare a list of validators to be applied on their input models.

The <validators> element is the top-level element under which are nested individual <Validator> definitions.  See here for further details on ShapeChange model validators and their specific configuration options.

Each model validator listed in the configuration can be switched off by setting the "mode" attribute to "disabled". The default value is "enabled".

A model validator can have "validationMode" attribute set to 'strict' (the default) and to 'lax'. In case of strict validation, any failed validation check will cause the transformation or target derivation of the validated model to not be executed, whereas lax validation means that processing does continue.

A sample <validators> section of a configuration file can look like the following:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<validators>
  <Validator id="valDocumentation" class="de.interactive_instruments.ShapeChange.ModelValidation.Basic.BasicModelValidator" mode="enabled" validationMode="strict">
    <advancedProcessConfigurations>
      <BasicContentTests>
        <tests>
          <!-- Is the documentation of every feature type, attribute, and enum present? -->
          <DescriptorContentTest descriptorOrTaggedValue="documentation" regex="^.+$" modelElementType="Class" modelElementStereotype="(?i)featuretype"/>
          <DescriptorContentTest descriptorOrTaggedValue="documentation" regex="^.+$" modelElementType="Attribute" modelElementOwnerStereotype="(?!(?i)codelist).*"/>
        </tests>
      </BasicContentTests>
    </advancedProcessConfigurations>
  </Validator>
  <Validator id="valPropertyTaggedValues" class="de.interactive_instruments.ShapeChange.ModelValidation.Basic.BasicModelValidator" mode="enabled" validationMode="strict">
    <advancedProcessConfigurations>
      <BasicContentTests>
        <tests>
          <!-- Does every property (excluding enums and codes) have tags inlineOrByReference and sequenceNumber with valid values? -->
          <DescriptorContentTest descriptorOrTaggedValue="TV:inlineOrByReference" regex="^(inline|byReference|inlineOrByReference)$" modelElementType="Property"
            modelElementOwnerStereotype="(?!(?i)(enumeration|codelist)).*"/>
          <DescriptorContentTest descriptorOrTaggedValue="TV:sequenceNumber" regex="^\d+$" modelElementType="Property" modelElementOwnerStereotype="(?!(?i)(enumeration|codelist)).*"/>
        </tests>
      </BasicContentTests>
    </advancedProcessConfigurations>
  </Validator>
</validators>